Computer programs are written in one or more computer programming languages. A computer program originates from one or more source code files written in the one or more programming languages. The source code files are subsequently interpreted by a runtime or execution environment, or compiled into object code and linked into a binary executable.
A programming language is defined by a grammar which sets forth the syntactic rules governing that programming language. The grammar will comprise a set of grammar elements which include a set of primitive symbols and a set of rules on what constitute valid combinations of the symbols into higher level. For example, the primitive symbols may comprise American Standard Code for Information Interchange (“ASCII”) characters, which may be combined into terms, and where terms may then be combined with additional characters and other terms into expressions. Grammars are often formally represented with Backus-Naur Form (“BNF”).
While a grammar defines the syntax of a programming language, a program comprises a set of semantic statements, expressed in one or more expressions in the syntax of the programming language. A set of expressions in the syntax of the programming language that corresponds to a semantic statement in the source code of a program is called a source code construct. Accordingly, a source code of program contains one more source code constructs, which ultimately will instruct a processor on how to execute according to the semantics of the program.
It is laborious to create a computer program. Production of a commercial computer program, may take years to develop. Examples include the Windows™ operating system where various releases have taken four years with thousands of developers to complete. In addition to writing the source code, the program must also be verified to operate according to the semantics expected by the designers and by customers. Thus a computer program represents a non-trivial investment by developers and customers alike.
However, as a computer program is maintained, over time it may be desirable to change one or more of the underlying programming languages used in the program. For example, new versions of the underlying programming languages may occur over time. For example, the FORTRAN programming language according to the FORTRAN 77 standard is different from the FORTRAN 90 standard. By way of another example, Visual Basic 7™ which is based on the .NET™ framework, is not fully backwards compatible with Visual Basic 6™ which is based on the Common Object Model (“COM”) framework.
Changes to one or more of the underlying programming languages used in the program may also be motivated by the need to port a program to different platforms. For example, a mobile application targeting the Android™ operating system is typically written in the Java™ programming language. However, if that mobile application is to be ported to Apple's iOS™ operating system, then that mobile application might potentially be rewritten in the Objective C programming language.
A platform change need not be from one device to another, but may be to a different target topology altogether. For example, an application initially written for a client-server, two-tier, Local Area Network (“LAN”) environment might be ported to a mobile device/application server/database three tier cloud environment. By way of another example, an application originally written for a single core, single processor environment might be ported to a different programming language as part of a refactoring effort to target symmetric multi-processor (“SMP”) environments, or massively multi-core processors. There are cases where a program originally written in a structural programming language, such as the C programming language, is ported to a functional programming language, such as Erlang to better handle parallelism.
Present porting efforts, such as described above, as well as for more general refactoring are typically done manually, thus duplicating the cost of initial development and validation. Accordingly, there is an opportunity to fully automate porting while guaranteeing fidelity by transforming programming language constructs.